<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>利用伪元素图片添加边框</title>
    <!-- 伪元素的本质就是在html中增加一个元素标签或者说盒子都行，但是在html中审查不到 -->
    <style>
        * {
            margin: 0;
            padding: 0;
        }
    .main {
        width: 1226px;
        height: 460px;
        position: relative;
        margin: 100px auto;
    }
    .main:hover::before {
        content: "";
        display: block;
        width: 100%;
        height: 100%;
        border: 20px solid rgba(0, 0, 0, .3);
        position: absolute;
        top: 0;
        box-sizing: border-box;
    }
    </style>
</head>
<body>
    <div class="main">
        <img src="../img/xm.jpg">
    </div>
</body>
</html>